package com.cwt.sso.genericity;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author chenwt
 * @version V1.0
 * @describe 【类型通配符】
 * @date 2023年08月22日 10:18:57
 */
public class Type {

    private static final Logger logger = LoggerFactory.getLogger(Type.class);

    public static void main(String[] args) {
        List<String> name = new ArrayList<String>();
        List<Integer> age = new ArrayList<Integer>();
        List<Number> number = new ArrayList<Number>();

        name.add("icon");
        age.add(18);
        number.add(314);

        logger.info("类型通配符使用问号 ? 表示，表示可以接受任意类型的参数。");

        showData(name);
        showData(age);
        showData(number);

        showNumData(age);
        showNumData(number);
    }

    public static void showData(List<?> list) {
        logger.info("AllType >> " + list.get(0));
    }

    public static void showNumData(List<? extends Number> list) {
        logger.info("Number >> " + list.get(0));
    }

    public static void showMapData(List<? extends Map> list) {
        logger.info("Number >> " + list.get(0));
    }

}
